#pragma once
#include "ClientSessionManager.h"
#include "NetMsgHandler.h"


class ClientSession
{
public:
	ClientSession(struct bufferevent *pEv);

	void Init();

	struct bufferevent *GetEv() {return m_pEv;}
	void SetEv(struct bufferevent *ev) {m_pEv = ev;}

	std::string getPlayerId() {return m_strPlayerId;}
	void SetPlayerId(const std::string &strPlayerId) {m_strPlayerId = strPlayerId;}

	void AddOneMessage(const std::string &strMessage);
	void GetOneMessage(std::string &strMessage);

	void RegisterMessageHandler();

	void HandleMessage();

	int HandlePlayerLogon(const std::string &strMessage);

private:
	struct bufferevent *m_pEv;

	//int m_nPlayerId;
	std::string m_strPlayerId;

	Queue<std::string> m_msgQueue;

	NetMsgHandler<ClientSession> m_netMsgHandler;

};

